<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加会员卡</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/css/common.css">
<!--公共样式结束-->
<!--表单公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/css/model_form.css">
<!--表单公共样式结束-->
<!--私有样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/css/page_vipcard.css">
<!--私有样式结束-->
<!--FontAwesome开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/plugins/FontAwesome/css/font-awesome.min.css">
<!--FontAwesome结束-->
<!--核心JS开始-->
<script src="{$NOW_THEME_URL}/Assets/js/jquery.min.js"></script>
<script src="{$Think.ABS_URL}/Public/Js/jquery-migrate-1.2.1.min.js"></script>
<!--核心JS结束-->
<script type="text/javascript">
	$(function(){
		$('#goBack').on('click',function(){
			window.history.back();
		});
		
		/*右侧导航点击事件*/
		$('.hb_right').click(function(){
			$(".wrapper").toggleClass("a");
			$(".nav_box").toggleClass("b");
		});
		
		/*右侧导航二级*/
		$('.erji').click(function(){
			$(this).find("ul").toggleClass("c");
		});
		
		//表单提交
		$('.btn').live('click',function(){
			$('.forms').submit();
		})
	});
</script>
</head>
<body>
<!-- 头部开始-->
<include file="Public:header"/>
<!-- 头部结束-->
<!--主体开始-->
<div id="pageHome">
	<!--主体盒子开始-->
    <div id="wrapper" class="wrapper radius_5 bg_white">
    	<!--面包屑导航开始-->
        <ul class="pagePosition clearfix">
        	<li><a href="{:U('Index/index')}"><i class="icon-home"></i> 首页</a></li>
            <li><i class="icon-angle-right"></i></li>
            <li><a href="#">添加会员卡</a></li>
        </ul>
        <!--面包屑导航结束-->
        <div class="space_hx">&nbsp;</div>
        <!--添加会员卡开始-->
        <div class="box_add">
        	<form action="{:U('Vipcard/vip_add')}" method="post" name="MyForm1" id="MyForm1" class="forms">
            	<select name="vipid" class="input_text">
                	<option value="">请选择会员卡类型</option>
					<option value="1">绿叶水果普通会员卡</option>
            	</select>
                <input name="realname" type="text" placeholder="请输入姓名"/>
                <input name="mobile" type="text" placeholder="请输入联系电话"/>
                <span>生日：</span>
                <select name="YYYY" onChange="YYYYDD(this.value);" class="years" >
                </select>
                <select name="MM"   onChange="MMDD(this.value);" class="months">
                </select>
                <select name="DD"   class="days">
                </select>
            </form>
            <div class="btn bg_green">确定</div>
            <div class="space_hx">&nbsp;</div>
        </div>
        <!--添加会员卡结束-->
    </div>
    <!--主体盒子结束 -->

    <include file="Public:menu" />
</div>
<!--主体结束-->
</body>
</html>
<script type="text/javascript">
function saveApp(){
	$("#MyForm1").submit();	
}
function YYYYMMDDstart() 
{
	MonHead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	var y = new Date().getFullYear();
	for (var i = y; i > (y-100); i--)
	document.MyForm1.YYYY.options.add(new Option(i, i));

	for (var i = 1; i < 13; i++) 
	document.MyForm1.MM.options.add(new Option(i,i));

	document.MyForm1.YYYY.value = y;
	document.MyForm1.MM.value = new Date().getMonth() + 1;

	var n = MonHead[new Date().getMonth()];
	if (new Date().getMonth() == 1 && IsLeapYear(YYYYvalue)) n++;
	writeDay(n);
	document.MyForm1.DD.value = new Date().getDate();t
} 

if(document.attachEvent) 
	window.attachEvent("onload", YYYYMMDDstart);
else
	window.addEventListener('load', YYYYMMDDstart, false);

function YYYYDD(str)
{	var MMvalue = document.MyForm1.MM.options[document.MyForm1.MM.selectedIndex].value;
	if (MMvalue == "")
	{	var e = document.MyForm1.DD;
		OptionsClear(e);
		return;
	} 
	var n = MonHead[MMvalue - 1];
	if (MMvalue ==2 && IsLeapYear(str)) n++;
	writeDay(n) 
}

function MMDD(str)
{	var YYYYvalue = document.MyForm1.YYYY.options[document.MyForm1.YYYY.selectedIndex].value;
	if (YYYYvalue == "")
	{	var e = document.MyForm1.DD;
		OptionsClear(e);
		return;
	} 
	var n = MonHead[str - 1];
	if (str ==2 && IsLeapYear(YYYYvalue)) n++;
	writeDay(n) 
}

function writeDay(n)
{
	var e = document.MyForm1.DD;
	var index=e.selectedIndex;
	OptionsClear(e);
	for (var i=1; i < (n+1); i++) 
		e.options.add(new Option(i, i));
	if(index<n)
		e.selectedIndex=index;
	else
		e.selectedIndex=n-1;
}

function IsLeapYear(year)
{	return(year%4 == 0 && year%100 !=0 || year%400 == 0);
}

function OptionsClear(e) 
{	e.options.length = 0;
}
</script>